/*
 * YuebaoTextView.h
 *
 *  Created on: 2011-3-17
 *      Author: 
 */

#ifndef YuebaoTextView_H_
#define YuebaoTextView_H_

#include "fFramework.h"
#include "fBaseControl.h"
#include "CutString.h"
#include "fScrollBar.h"
class fTextView : public fControlBase
{
public:
    ~fTextView( );
    static fTextView *NewL( fEngine * aEngine );
    static fTextView *NewLC( fEngine * aEngine );
private:
    fTextView( );
    void ConstructL( fEngine * aEngine );
public:
    virtual void RenderFrame( );
    virtual void HandleKey( f_KEY_DES * aKeyDes );
    TInt HandleMouse( fMouseEvent /*nType*/, TPoint /*sPoint*/)
    {
        return 0;
    }
public:
   void PositonChanged( int x, int y );
public:
    void SetContent( const TDesC& content );
    void SetFontHeight( int size );
    void SetRect( const TRect& aRect );
    int ContentHeight( );
protected:
    CFont* _font;
    HBufC* _content;
public:
    void SetColor( int background, int foreground )
    {
        _back_color = background;
        _text_color = foreground;
    }
    void SetTextColor( int foreground )
    {
        _text_color = foreground;
    }
protected:
    int _text_color;
    int _back_color;
public:
    enum TTextAlignH
    {
        ELeft, EHCenter, ERight
    };
    enum TTextAlignV
    {
        ETop, EVCenter, EBottom
    };
public:
    void SetTextAlign( int hor, int vec )
    {
        _text_align_h = hor;
        _text_align_v = vec;
    }
public:
    void SetScrollBarVisable( bool visiable )
    {
        _scrollbar->MakeVisible( visiable );
        _showScrollbar = visiable;
    }
private:
    bool _showScrollbar;
protected:
    int _text_align_h;
    int _text_align_v;
protected:
    StringSpliteUtility* _stringSpliter;
private:
    int _screen_offset_y;
    int _total_height;
protected:
    fVScrollBar* _scrollbar;
};
#endif /* YuebaoTextView_H_ */
